package com.shuwang.business.until;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Created by Riley on 2017/2/15.
 */
public class DTBuilder {

    public final static String TimeStampToDatetime(Long date) {
        SimpleDateFormat format =  new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss" );
        Long time=new Long(date);
        return  format.format(time);
    }

    public final static String TimeStampToDate(Long date) throws ParseException {
        SimpleDateFormat format =  new SimpleDateFormat("yyyy-MM-dd");
        Long time=new Long(date);
        String d = format.format(time);
        return d;
    }

    public final static Date TimeStampToTime(Long date) throws ParseException {
        SimpleDateFormat format =  new SimpleDateFormat("HH:mm:ss");
        Long time=new Long(date);
        String d = format.format(time);
        return format.parse(d);
    }

}
